<template>
  <div class="cooperativeSite">
    <zyInfoPanel title="基本信息" :showUnfoldButton="false" class="cooperativeSiteItem">
      <zy-button slot="title" type="primary" @click="toChange">修改</zy-button>
      <zyInfoPanelDetail :info="cooperativeSiteInfo" cellNum="4"></zyInfoPanelDetail>
    </zyInfoPanel>
    <zyInfoPanel title="证件信息" :showUnfoldButton="false">
      <div class="imgArea">
        <div class="licenseImg">
          <div class="imgTitle">营业执照(副本)：</div>
          <div class="imgContent">
            <zy-image v-model="license_img" class="img" v-if="license_img" readonly></zy-image>
          </div>
        </div>
        <div class="cardImg">
          <div class="imgTitle">法人身份证：</div>
          <div class="imgContent">
            <zy-image v-model="legal_card_pros" class="img" v-if="legal_card_pros" readonly></zy-image>
            <zy-image v-model="legal_card_cons" class="img" v-if="legal_card_cons" readonly></zy-image>
          </div>
        </div>
      </div>
    </zyInfoPanel>
  </div>
</template>

<script>
	export default {
		name: "CCooperativeSite",
		props: {},
		data() {
			return {
				cooperativeSiteInfo:[
					{
						name: "站点名称：",
						val: "",
						code: 'company_name'
					},
					{
						name: "站点地址：",
						val: "",
						code: 'company_address'
					},
					{
						name: "统一社会信用代码：",
						val: "",
						code: 'organization_code'
					},
					{
						name: "法人名称：",
						val: "",
						code: 'legal_person'
					},
					{
						name: "法人联系方式：",
						val: "",
						code: 'legal_phone'
					},
					{
						name: "法人身份证号码：",
						val: "",
						code: 'legal_card_no'
					},
					{
						name: "负责人：",
						val: "",
						code: 'control_man'
					},
					{
						name: "联系方式：",
						val: "",
						code: 'control_phone'
					},
        ],
				license_img: '',
				legal_card_cons: '',
				legal_card_pros: '',
      };
		},
		computed: {},
		watch: {},
		components: {},
		methods: {
			getData() {
				this.$axios.post(this.$api.c_getCompanyInfo, {}).then(res => {
					let {code, msg, data} = res;
					this.loading = false;
					if (code == 200) {
						this.cooperativeSiteInfo = this.cooperativeSiteInfo.filter(item=>{
							item.val = data.info[item.code];
							return item
						});
						this.license_img = data.info.license_img;
						this.legal_card_cons = data.info.legal_card_cons;
						this.legal_card_pros = data.info.legal_card_pros;
					} else {
						this.$message.error(msg);
					}
				}).catch(ret => {
					this.$message.error(ret.msg || '服务繁忙，请稍后再试');
				});
			},
			toChange(){
				this.$toRoutePath({
					path: "/cooperate/cooperative_site/detail",
					edit: true,
					query: {}
				});
      }
		},
		mounted() {
			this.getData();
		},
		created() {
		}
	}
</script>

<style scoped lang="less" src="@/style/cooperate/cooperation/cooperativeSite/index.less">

</style>
